<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:variable name="cssPath" select="simorg/paths/css" />
	<xsl:variable name="imagePath" select="/simorg/paths/images" />
	<xsl:variable name="rootUrl" select="simorg/paths/rootUrl" />
	
	<xsl:template match="/">
		<html xmlns:html="http://www.w3.org/TR/xhtml1/strict" lang="en-US" >
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
				<link type="text/css" href="{$cssPath}/custom-theme/jquery-ui-1.8.9.custom.css" rel="Stylesheet"/>
				<link type="text/css" href="{$cssPath}main.css" rel="Stylesheet"/>
				<script type="text/javascript" src="http://localhost:8091/simorg/js/jquery-1.4.4.min.js"/>
				<script type="text/javascript" src="http://localhost:8091/simorg/js/jquery-ui-1.8.9.custom.min.js"></script>
				<script type="text/javascript" src="http://localhost:8091/simorg/js/ui.spinner.js"></script>
				
				<script type="text/javascript">
					$(document).ready(function(){
  						$("input:submit", ".formdiv" ).button();
  						$("#numCompoundsToComplete").spinner({min: 1, max: 100, increment: 1});
  						$( ".date" ).datepicker();
  						$("input:submit, .toolba a", ".formdiv" ).button();
  						$('.striped tr:even').addClass('alt');
  					});
				</script>
				
				<title>SimOrg Assignment View</title>
			</head>
			<body>
				<div class="ui-widget top_toolbar" style="font-size:smaller"><span style="float:left" >Simorg Administration Dashboard</span><a class="logoutLink" href="{$rootUrl}admin/logout">logout</a></div>
             	
				 <form name="assignment" action="{$rootUrl}assignment/save/{/simorg/selected-assignment/assignment/@id}" method="post">
				 	<div id="primaryformdiv" class=" ui-widget ui-widget-content ui-corner-all">
						<h3 style="margin:0px;padding:.5em" class="ui-widget-header div-title">Assignment Details</h3>
						<div class="formdiv ui-widget-content">
							<fieldset>
								<div class="columnfieldlist">
									<ol>
										<li>
											<label for="title">Title</label>
											<input type="text" name="title" id="title" value="{/simorg/selected-assignment/assignment/title}" />
										</li>
										<li>
											<label for="title">Number of compounds to complete</label>
											<input type="text" name="numCompoundsToComplete" id="numCompoundsToComplete" value="{/simorg/selected-assignment/assignment/numCompoundsToComplete}" />
										</li>
									</ol>
								</div>
								<div class="columnfieldlist">
									<ol>
										<li>
											<label for="title">Assigned Date</label>
											<input class="date" type="text" name="assignedDate" id="assignedDate" value="{/simorg/selected-assignment/assignment/assignedDate}" />
										</li>
										<li>
											<label for="title">Due Date</label>
											<input class="date" type="text" name="dueDate" id="dueDate" value="{/simorg/selected-assignment/assignment/dueDate}" />
										</li>
									</ol>
								</div>
							</fieldset>
							<h3>Active Compounds</h3>
             				<table class="striped borderedTable ui-corner-all" style="margin-top:1em;width:100%">
		             			<tr>
		             			<th style="padding-left:2em;text-align:left">Compound</th>
		             			<th style="padding-left:2em;text-align:left">Class</th>
		             			</tr>
		             			<xsl:for-each select="/simorg/compounds/compound">
		             			<tr>
		             				<td style="padding-left:2em;text-align:left">
		             					<xsl:variable name="thisid"> <xsl:value-of select="@id"/></xsl:variable>
										<xsl:choose>
											<xsl:when test="count(/simorg/selected-assignment/assignment/assignedCompounds/compound[@id=$thisid]) &gt; 0">
												<input id="compound_{@id}" name="compound_{@id}" checked="checked" type="checkbox"/> 
											</xsl:when>
											<xsl:otherwise>
												<input id="compound_{@id}" name="compound_{@id}" type="checkbox"/> 
											</xsl:otherwise>
										</xsl:choose>
										<label class="checkboxlabel" for="compound_{@id}"><xsl:value-of select="label"/></label>
		             				</td>
		             				<td style="padding-left:2em;text-align:left"><xsl:value-of select="class"/></td>
		             			</tr>
		             			</xsl:for-each>
             				</table>
             				<div class="toolbar"><input type="submit" value="Save Changes" /></div>
						</div>
             		</div>
					</form>
					
					
			</body>
		</html>
	</xsl:template>
	
</xsl:stylesheet>